package doctor_model

import (
	"gorm.io/gorm"
	"jjqzplucky.site/sz-core/internal/models"
	"jjqzplucky.site/sz-core/pkg/types"
)

type Doctor struct {
	models.BaseModel
	Name        string    `json:"name"`
	Pid         string    `json:"pid"`
	Uuid        string    `json:"uuid"`
	Photo       string    `json:"photo"`
	Birthday    *types.LocalTime `json:"birthday"`
	Sex         int8      `json:"sex"`
	School      string    `json:"school"`
	Degree      string    `json:"degree"`
	Tel         string    `json:"tel"`
	Email       string    `json:"email"`
	Job         string    `json:"job"`
	Remark      string    `json:"remark"`
	Description string    `json:"description"`
	Hiredate    *types.LocalTime `json:"hiredate"`
	Tag         string    `json:"tag"`
	Recommended int8      `json:"recommended"`
	Status      int8      `json:"status"`
}

func (d *Doctor) BeforeCreate(tx *gorm.DB) error {
	err := d.BaseModel.BeforeCreate(tx)
	if err != nil {
		return err
	}
	return nil
}

type QueryParams struct {
	Name        *string `form:"name"`
	DeptId      *uint   `form:"deptId"`
	Degree      *string `form:"degree"`
	Job         *string `form:"job"`
	Recommended *int8   `form:"recommended"`
	Status      *int    `form:"status"`
	Page        int     `form:"page"`
	PageSize    int     `form:"pageSize"`
	Total       int64    
}

type DoctorVO struct {
	models.BaseModel
	Name     string `json:"name"`
	Sex      int8   `json:"sex"`
	School   string `json:"school"`
	Degree   string `json:"degree"`
	Tel      string `json:"tel"`
	Job      string `json:"job"`
	DeptName string `json:"dept_name"`
	SubName  string `json:"sub_name"`
	Status   int8   `json:"status"`
}

type DoctorDto struct {
	Id uint64 `json:"id"`
	Name        string    `json:"name" binding:"required"` 
	Pid         string    `json:"pid" binding:"required"`
	Uuid        string    `json:"uuid" binding:"required"`
	Photo       string    `json:"photo"`
	Birthday    *types.LocalTime `json:"birthday"`
	Sex         int8      `json:"sex" binding:"required"`
	School      string    `json:"school"`
	Degree      string    `json:"degree"`
	Tel         string    `json:"tel" binding:"required"`
	Email       string    `json:"email"`
	Job         string    `json:"job"`
	Remark      string    `json:"remark"`
	Description string    `json:"description"`
	Hiredate    *types.LocalTime `json:"hiredate"`
	Tag         string    `json:"tag"`
	Recommended int8      `json:"recommended"`
	Status      int8      `json:"status"` 
	SubId       uint64     `json:"subId"`
}